import Vue from 'vue';
import VueRouter from 'vue-router';
import Home from '@/views/home.vue';
import Login from '@/views/login.vue';
import SupplierMarket from '@/views/supplierMarket.vue';
import SupplierMarketDetail from '@/views/supplierMarket-detail.vue';
import DemandMarket from '@/views/demandMarket.vue';
import DemandMarketDetail from '@/views/demandMarket-detail.vue';
import EnterpriseCenter from '@/views/enterpriseCenter.vue';
import Register from '@/views/register.vue';
import Center from '@/views/center/profile.vue';  
Vue.use(VueRouter);

const routes = [
  {
    path: '/',
    name: 'home',
    component: Home
  },
  {
    path: '/register',
    name: 'register',
    component: Register
  },
  {
    path: '/login',
    name: 'login',
    component: Login
  },
  {
    path: '/supplier',
    name: 'supplierMarket',
    component: SupplierMarket
  },
  {
    path: '/supplierMarketDetail',
    name: 'supplierMarketDetail',
    component: SupplierMarketDetail
  },
  {
    path: '/demand',
    name: 'demandMarket',
    component: DemandMarket
  },
  {
    path: '/demandMarketDetail',
    name: 'demandMarketDetail',
    component: DemandMarketDetail
  },
  {
    path: '/enterprise',
    name: 'enterpriseCenter',
    component: EnterpriseCenter
  },
  {
        path: '/center/profile',
        name: 'center',
        component:Center,
  },
];

const router = new VueRouter({
  mode: 'hash',
  routes
});

const originalPush = VueRouter.prototype.push
VueRouter.prototype.push = function push(location) {
  return originalPush.call(this, location).catch(err => err)
}
export default router;